﻿using System;
using System.Web.Security;

namespace Bingosoft.WebApp
{
    public partial class Login : System.Web.UI.BasePage
    {
        protected string UserName { get; private set; }

        protected string Message { get; private set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)    
            {
                string username = Request["username"];
                string password = Request["password"];

                if (string.IsNullOrEmpty(username))
                {
                    Message = "请输入用户名！";
                    return;
                }

                if (Membership.ValidateUser(username,password))
                {
                    FormsAuthentication.RedirectFromLoginPage(username,false);
                }
                else
                {
                    UserName = username;
                    Message  = "用户名或密码不正确，请重新输入！";
                }
            }
        }
    }
}